import Vue from 'vue'
import App from './App.vue'

// 确保路由定义兼容性
if (typeof __wxConfig === 'object' && !__wxConfig.__route__) {
  __wxConfig.__route__ = 'pages/game/game';
}

// 在Vue实例化前添加
const app = new Vue({
  data() {
    return {
      globalData: {
        userInfo: {},
        SDKVersion: ''
      }
    }
  },
  ...App
})

// 挂载到Vue原型链
Vue.prototype.$globalData = app.$data.globalData

// 确保wx对象存在
if (typeof wx !== 'undefined') {
  const appBaseInfo = wx.getAppBaseInfo?.() || {}
  app.$data.globalData.SDKVersion = appBaseInfo.SDKVersion || '3.7.7'
}

Vue.config.productionTip = false
App.mpType = 'app'

app.$mount()